function [crackCenter,crackNormal,isCrack] = computeCrack(e,element)
ng = e.getNumGaussPoint();
f = e.getFace();
isCrack = 0;
for j=1:ng
    sigma = element.stress(:,j);
    %perform spectral decomposition
    oxx = sigma(1);
    oyy = sigma(2);
    oxy = sigma(3);
    t1 = (oxx + oyy) / 2;
    t2 = sqrt(((oxx - oyy)/2)^2 + oxy^2);
    o1 = t1 + t2;
    if o1 >= element.ft
        isCrack = 1;
        
        %% realize crack center
        crackCenter = f.computeCenter();
        
        %% realize crack normal
        sigma_avg = [0 0 0]';
        for k=1:ng
            sigma_avg = sigma_avg + element.stress(:,k);
        end
        oxx = sigma_avg(1)/ng;
        oyy = sigma_avg(2)/ng;
        oxy = sigma_avg(3)/ng;
        t1 = (oxx + oyy) / 2;
        t2 = sqrt(((oxx - oyy)/2)^2 + oxy^2);
        o1 = t1 + t2;
        if abs(oxy) < 1e-12
            if (oxx > oyy)
                n1 = 1;
                n2 = 0;
            else
                n1 = 0;
                n2 = 1;
            end
        else
            g = sqrt((oxx - o1)^2 + oxy^2);
            n1 = -oxy / g;
            n2 = (oxx - o1) / g;
        end
        crackNormal = [n1 n2]';
        
        break;
    end
end
if isCrack == 0
    crackCenter = [];
    crackNormal = [];
end
end